package org.apache.lucene.document;

import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.NumericUtils;

public class IntField extends Field{

	public IntField(String name, int value, FieldType type) {
		super(name, type);
		this.fieldsData = Integer.valueOf(value);
	}
	
	@Override
	public BytesRef binaryValue() {
		byte[] bytes = new byte[Integer.BYTES];
		NumericUtils.intToSortableBytes((Integer)this.fieldsData, bytes, 0);
		return new BytesRef(bytes);
	}

}
